<?php
/**
 * Created By virus_cms
 * Author: Virus
 * Date: 2020/3/22
 * Time: 20:38
 */

namespace app\common\bussiness;


use app\common\model\mysql\Article;

class ArticleBusiness
{
    protected $model = null;

    public function __construct()
    {
        $this->model = new Article();
    }

    public function getList()
    {
        $result = $this->model->getList();
        if (empty($result)) {
            return [];
        }

        return $result->toArray();
    }

    public function getOneArticleById($id)
    {
        $result = $this->model->getOneArticleById($id);
        if (empty($result)) {
            return [];
        }

        return $result;
    }

    public function deleteById($id)
    {
        $result = $this->model->deleteById($id);
        if (!$result) {
            return false;
        }

        return true;
    }
}